#include "discovery/eventfd_sender.h"

EventFdSender::EventFdSender(io_context& io, const std::string& identifier)
    : io_(io), identifier_(identifier), running_(false), retry_count_(0), max_retry_count_(5) {
}

EventFdSender::~EventFdSender() {
    stop();
}

void EventFdSender::stop() {
    running_ = false;
}

void EventFdSender::set_transfer_callback(TransferCallback callback) {
    transfer_callback_ = std::move(callback);
}

void EventFdSender::set_connection_callback(ConnectionCallback callback) {
    connection_callback_ = std::move(callback);
}

void EventFdSender::set_timeouts(std::chrono::milliseconds connect_timeout,
                                std::chrono::milliseconds retry_interval) {
    connect_timeout_ = connect_timeout;
    retry_interval_ = retry_interval;
}

bool EventFdSender::is_running() const {
    return running_.load();
}
